<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/page-base.tld" prefix="w"%>
<%@page import="com.wframe.framework.util.UploadUtil"%>
<%String path=request.getContextPath();
    request.setAttribute("fileserver", UploadUtil.getConfig().getDownserver());
%>
<script>
    function availableTo() {

        $w.doUrl(ctx + "/floor/UiFloorPanelPage@updatestatus.page?bean.state=AVAILABLE", $("#floorForm").serializeArray(), function (re) {
            if(re){$w.execForm({"form":$("#floorForm")});$w.listFlesh=true;}
        })
    }
    function unavailableTo() {
        $w.doUrl(ctx + "/floor/UiFloorPanelPage@updatestatus.page?bean.state=UNAVAILABLE", $("#floorForm").serializeArray(), function (re) {
            if(re){$w.execForm({"form":$("#floorForm")});$w.listFlesh=true;}
        })
    }
    function removedTo() {
        $w.doUrl(
            ctx + "/floor/UiFloorPanelPage@updatestatus.page?bean.state=REMOVED", $("#floorForm").serializeArray(), function (re) {
                if(re){$w.execForm({"form":$("#floorForm")});$w.listFlesh=true;}
            })
    }
    function showPanelItems(id){
        $w.openDialog({url:ctx+'/floor/UiFloorProductPage@execute.page?bean.panelId='+id,title:"面板类目",w:700,h:400,maximized: true,afterClose:function(re){
            if(re){$w.execForm({"form":$("#floorForm")});$w.listFlesh=true;}
        }});
    }
    function editPanelProducts(id){
        $w.openDialog({url:ctx+'/floor/UiFloorProductPage@panelProductsShow.page?bean.id='+id,title:"编辑面板类目",w:865,h:480,maximized: true,afterClose:function(re){
            if(re){$w.execForm({"form":$("#floorForm")});$w.listFlesh=true;}
        }});
    }
    function editUiFloorPanel(id) {
        window.parent.$w.openDialog({
            url: ctx + '/floor/UiFloorPanelPage@show.page?bean.id=' + id,
            title: "修改面板 ",
            w: 540,
            h: 500,
            afterClose: function (re) {
                if(re){$w.execForm({"form":$("#floorForm")});$w.listFlesh=true;}
            }
        });
    }
    function addPanlFloor(ui_floor_id) {
        window.parent.$w.openDialog({
            url: ctx + '/floor/UiFloorPanelPage@uiFloorPanelAdd.page?bean.ui_floor_id='+ui_floor_id,
            title: "添加面板 ",
            w: 600,
            h: 500,
            afterClose: function (re) {
                if(re){$w.execForm({"form":$("#floorForm")});$w.listFlesh=true;}
            }
        });
    }

</script>

<div class="easyui-layout" fit="true">
    <div data-options="region:'center'">
        <form id="floorForm" action="/floor/UiFloorPanelPage.page" method="post">
            <w:hidden bind="bean.ui_floor_id"/>
            <w:hidden bind="bean.id"/>
            <!-- 操作区域 -->
            <div class="easyui-panel ui-toolBar" border="false" data-options="doSize:false">
                <a href="javascript:;" class="easyui-linkbutton" plain="true" onclick="addPanlFloor(<w:write bind="bean.ui_floor_id"/>)" style="width:50px;">添加</a>
                <a href="javascript:;" class="easyui-linkbutton" plain="true" onclick="availableTo()"
                   style="width:50px;">展示</a>
                <a href="javascript:;" class="easyui-linkbutton" plain="true" onclick="unavailableTo()"
                   style="width:50px;">隐藏</a>
                <a href="javascript:;" class="easyui-linkbutton" plain="true" onclick="removedTo()" style="width:50px;">删除</a>
            </div>
            <div class="ui_line" style="margin-top:10px"></div>
            <!-- 数据列表区域 -->
            <table class="ui-table" width="100%" cellpadding="1" cellspacing="1" data-options="showPage:false">
                <thead>
                <tr class="ui_th">
                    <td width="35" align="center"><input type="checkbox"  onclick="$selAllTbBoxs(this)"></td>
                    <td >ID</td>
                    <td>面板名称</td>
                    <td>标题栏模式</td>
                    <td >面板主图</td>
                    <td >面板颜色</td>
                    <td>面板链接</td>
                    <td>面板布局</td>
                    <td>排序</td>
                    <td>面板类型</td>
                    <td>创建时间</td>
                    <td>状态</td>
                    <td width="130" align="center">操作</td>
                </tr>
                </thead>
                <tbody>
                <w:iterate id="info" bind="resultList_">
                    <tr class="ui_td">
                        <td align="center"><input type="checkbox" name="primaryKey_" value="<w:write bind="#info.id"/>">
                        </td>
                        <td><w:write bind="#info.id"/></td>
                        <td><w:write bind="#info.title"/></td>
                        <td>
                            <w:equal bind="#info.title_mode" value="LEFT_AND_MORE">标题居左更多居右</w:equal>
                            <w:equal bind="#info.title_mode" value="CENTER_NO_MORE">标题居中隐藏更多</w:equal>
                            <w:equal bind="#info.title_mode" value="LEFT_NO_MORE">标题居左隐藏更多</w:equal>
                            <w:equal bind="#info.title_mode" value="NO_TITLE_MORE">隐藏标题隐藏更多</w:equal>
                        </td>
                        <td><w:notEqual bind="#info.image" value=""><img src="${fileserver }<w:write bind="#info.image"/>" style="width:40px;height:30px;"></w:notEqual></td>
                        <td><w:write bind="#info.color"/></td>
                        <td><w:write bind="#info.link"/></td>
                        <td>
                            <w:equal bind="#info.layout" value="WE_LEFT_ONE_RIGHT_TWO">[微商城]左一右二布局</w:equal>
                            <w:equal bind="#info.layout" value="WE_LEFT_ONE_RIGHT_FOUR">[微商城]左一右四布局</w:equal>
                            <w:equal bind="#info.layout" value="WE_LEFT_TWO_RIGHT_ONE">[微商城]左二右一布局</w:equal>
                            <w:equal bind="#info.layout" value="WE_TWO_COLUMN">[微商城]两列布局</w:equal>
                            <w:equal bind="#info.layout" value="WE_FOUR_COLUMN">[微商城]四列布局</w:equal>
                        </td>
                        <td><w:write bind="#info.sort_value"/></td>
                        <td>
                            <w:equal bind="#info.type" value="ITEM">链图模式</w:equal>
                            <w:equal bind="#info.type" value="PRODUCT">商品列表</w:equal>
                        </td>
                        <td><w:write bind="#info.create_time"/></td>
                        <td>
                            <w:equal bind="#info.state" value="AVAILABLE">展示</w:equal>
                            <w:equal bind="#info.state" value="UNAVAILABLE">隐藏</w:equal>
                            <w:equal bind="#info.state" value="REMOVED">删除</w:equal>
                        </td>
                        <td align="center">
                            <a href="javascript:;" class="ui_btn marginR8" onclick="editUiFloorPanel(<w:write bind="#info.id"/>)">修改</a>
                            <w:notEqual bind="#info.type" value="ITEM"><a href="javascript:;" class="ui_btn marginR8"onclick="editPanelProducts(<w:write bind="#info.id"/>)">编辑</a></w:notEqual>
                            <w:notEqual bind="#info.type" value="PRODUCT"><a href="javascript:;" class="ui_btn marginR8"onclick="showPanelItems(<w:write bind="#info.id"/>)">编辑</a></w:notEqual>
                        </td>
                    </tr>
                </w:iterate>
                </tbody>
            </table>
        </form>
    </div>
</div>
